package com.jgsu.farm.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Data
@Table(name = "video")
public class Video implements Serializable {

    @Id
    @GeneratedValue(generator = "JDBC", strategy = GenerationType.IDENTITY)
    @NonNull
    private Integer videoid;

    private String name;

    private String format;

    private String description;

    private String author;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date time;

    private String location;

    private String device;

    @NonNull
    private String videofile;

    public Video(String name, String format, String description, String author, Date time, String location, String device, @NonNull String videofile) {
           this.name = name;
           this.format = format;
           this.description = description;
           this.author = author;
           this.time = time;
           this.location = location;
           this.device = device;
           this.videofile = videofile;
       }

}